﻿using System;
using System.Collections.Generic;
using System.Text;
using Abp.Dependency;
using Abp.Domain.Uow;
using Abp.Events.Bus.Entities;
using Abp.Events.Bus.Handlers;
using Abp.RemoteEventBus;
using Abp.Runtime.Caching;
using FwProject.Comm;
using FwProject.Core.Restaurant;

namespace FwProject.Application.EventHandle
{
    public class LoadingCarInfoHandle : IEventHandler<EntityChangedEventData<LoadingCarInfo>>, IEventHandler<EntityCreatedEventData<LoadingCarInfo>>, ITransientDependency
    {
        public readonly ICacheManager _catchmanager;
        public IRemoteEventBus remoteEventBus { get; set; }//缓存对象
        public LoadingCarInfoHandle(ICacheManager catchmanager)
        {
            _catchmanager = catchmanager;
            remoteEventBus = NullRemoteEventBus.Instance;
        }
        [UnitOfWork]
        public void HandleEvent(EntityChangedEventData<LoadingCarInfo> eventData)
        {
            ICache cache = _catchmanager.GetCache(nameof(LoadingCarInfo));
            cache.Remove("list");

            cache= _catchmanager.GetCache(nameof(LoadCar));
            cache.Remove("list");
        }
        /// <summary>
        /// 装车明细
        /// </summary>
        /// <param name="eventData"></param>
        public void HandleEvent(EntityCreatedEventData<LoadingCarInfo> eventData) {

          

        }
    }
}
